﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ShowDocuments.ascx.cs" Inherits="Manager_Lib_Controls_ShowDocuments" %>
<asp:Repeater id="rptDocs" runat="server" DataSourceID="lnqDocs">
	<HeaderTemplate>
		<table border="1" cellpadding="3" cellspacing="0">
			<tr>
				<th colspan="10">Document</th>
			</tr>
	</HeaderTemplate>
	<ItemTemplate>
		<tr>
			<td align="right">
				<input type="checkbox" id="chkFile" value='<%#Eval("ID")%>'/>
			</td>
			<td onclick="this.parentElement.cells[0].firstChild.click()" style="cursor:hand">
				<%# System.IO.Path.GetFileNameWithoutExtension(Eval("Path")+"") %>
			</td>
		</tr>
	</ItemTemplate>
	<FooterTemplate>
	<tr><th colspan="10"><INPUT type="button" value="Print" onclick="faxDocs()" id="btnFax"></th></tr>
		</table>
	</FooterTemplate>
</asp:Repeater>
<br>
<br>
<asp:LinqDataSource ID="lnqDocs" runat="server" OnSelecting="lnqDocs_Selecting" />
<script language="javascript">
	function faxDocs() {
		var aFiles = new Array;
		for (var i = 0; i < chkFile.length; i++)
			if (chkFile[i].checked) aFiles.push(chkFile[i].value);
		if (aFiles.length == 0) {
			alert("Please select at least one document.");
			return;
		}
		var docs = aFiles.join(",");
		var path = '<%=DocsPath%>';
		var url = "/manager/documents/ShowDocuments.aspx?Path=" + path + "&Docs=" + docs + "&ApplID=" + ApplID();
		location.href = url;
		//open(url	, "DOCUMENTS",		"resizable:1;status:0;help:0;dialogWidth:100px;dialogHeight:100px");
	}
</script>
